
import 'dart:convert';
import 'package:ichinesereader/models/school/SchoolAdminProfileDto.dart';
import 'package:ichinesereader/models/school/SchoolSettings.dart';
import 'package:ichinesereader/models/book/ProgramTypes.dart';

SchoolAdminProfile schoolAdminProfileFromJson(String str) =>
    SchoolAdminProfile.fromJson(json.decode(str));

String schoolAdminProfileToJson(SchoolAdminProfile data) =>
    json.encode(data.toJson());

class SchoolAdminProfile {
  SchoolAdminProfile({
    this.userId,
    this.userName,
    this.email,
    this.firstName,
    this.lastName,
    this.role,
    this.disabled,
    this.timestampDisabled,
    this.timestampEnabled,
    this.timestampCreated,
    this.timestampPasswordChanged,
    this.profileImageUrl,
    this.settings,
    this.deleted,
    this.lastLoggedIn,
    this.lastLogIn,
    this.school,
    this.accountStartDate,
    this.accountEndDate,
    this.classesInUse,
    this.notes,
    this.maxStudent,
    this.createdBy,
    this.blocked,
    this.blockedDate,
    this.timeZone,
    this.paid,
    this.schoolSettings,
    this.schoolCode,
    this.programType,
    this.theme,
    this.lang,
  });

  String? userId;
  String? userName;
  String? email;
  String? firstName;
  String? lastName;
  List<String>? role;
  bool? disabled;
  dynamic timestampDisabled;
  int? timestampEnabled;
  int? timestampCreated;
  int? timestampPasswordChanged;
  dynamic profileImageUrl;
  dynamic settings;
  bool? deleted;
  int? lastLoggedIn;
  dynamic lastLogIn;
  SchoolAdminProfileDto? school;
  int? accountStartDate;
  int? accountEndDate;
  int? classesInUse;
  String? notes;
  int? maxStudent;
  String? createdBy;
  bool? blocked;
  int? blockedDate;
  String? timeZone;
  bool? paid;
  SchoolSettings? schoolSettings;
  String? schoolCode;
  List<ProgramType>? programType;
  int? theme;
  int? lang;

  factory SchoolAdminProfile.fromJson(Map<String, dynamic> json) =>
      SchoolAdminProfile(
        userId: json["userId"],
        userName: json["userName"],
        email: json["email"],
        firstName: json["firstName"],
        lastName: json["lastName"],
        role: List<String>.from(json["role"].map((x) => x)),
        disabled: json["disabled"],
        timestampDisabled: json["timestampDisabled"],
        timestampEnabled: json["timestampEnabled"],
        timestampCreated: json["timestampCreated"],
        timestampPasswordChanged: json["timestampPasswordChanged"],
        profileImageUrl: json["profileImageUrl"],
        settings: json["settings"],
        deleted: json["deleted"],
        lastLoggedIn: json["lastLoggedIn"],
        lastLogIn: json["lastLogIn"],
        school: SchoolAdminProfileDto.fromJson(json["school"]),
        accountStartDate: json["accountStartDate"],
        accountEndDate: json["accountEndDate"],
        classesInUse: json["classesInUse"],
        notes: json["notes"],
        maxStudent: json["maxStudent"],
        createdBy: json["createdBy"],
        blocked: json["blocked"],
        blockedDate: json["blockedDate"],
        timeZone: json["timeZone"],
        paid: json["paid"],
        schoolSettings: SchoolSettings.fromJson(json["schoolSettings"]),
        schoolCode: json["schoolCode"],
        programType: List<ProgramType>.from(
            json["programType"].map((x) => ProgramType.fromJson(x))),
        theme: json["theme"] ?? 0,
        lang: json["lang"] ?? 0,
      );

  Map<String, dynamic> toJson() => {
        "userId": userId,
        "userName": userName,
        "email": email,
        "firstName": firstName,
        "lastName": lastName,
        "role": List<dynamic>.from(role!.map((x) => x)),
        "disabled": disabled,
        "timestampDisabled": timestampDisabled,
        "timestampEnabled": timestampEnabled,
        "timestampCreated": timestampCreated,
        "timestampPasswordChanged": timestampPasswordChanged,
        "profileImageUrl": profileImageUrl,
        "settings": settings,
        "deleted": deleted,
        "lastLoggedIn": lastLoggedIn,
        "lastLogIn": lastLogIn,
        "school": school?.toJson(),
        "accountStartDate": accountStartDate,
        "accountEndDate": accountEndDate,
        "classesInUse": classesInUse,
        "notes": notes,
        "maxStudent": maxStudent,
        "createdBy": createdBy,
        "blocked": blocked,
        "blockedDate": blockedDate,
        "timeZone": timeZone,
        "paid": paid,
        "schoolSettings": schoolSettings?.toJson(),
        "schoolCode": schoolCode,
        "programType": List<dynamic>.from(programType!.map((x) => x.toJson())),
        "theme": theme,
        "lang": lang,
      };
}
